package com.myCommunity.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.myCommunity.dao.ForumDao;
import com.myCommunity.entity.Forum;
@Repository("forumDao")
public class ForumDaoImpl extends BeseDao implements ForumDao{
	
	public List<Forum> getAll() {
		List<Forum> forumList = (List<Forum>) getHibernateTemplate().find("from Forum where parentId is not null");
		System.out.println(forumList.toString());
		return forumList;
	}
	
	public static void main(String[] args) {
		ForumDao forumDao= new ForumDaoImpl();
		List<Forum> list = forumDao.getAll();
		for(Forum forum:list){
			System.out.println(forum.toString());
		}
	}

	public List<Forum> getById(int id) {
		String hql="from Forum where id=?";
		List<Forum> list = (List<Forum>) getHibernateTemplate().find(hql,id);
		return list;
	}
}
